<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改年级')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-grade-edit" th:object="${grade}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">年级名称：</label>
                <div class="col-sm-8">
                    <input name="gradeName" th:field="*{gradeName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">年级主任：</label>
                <div class="col-sm-8">
                    <select name="teacherId" id="teacherId" class="form-control m-b" th:with="type=${@teacher.getTeacherList()}" required th:field="*{teacherId}" >
                        <option th:each="teacher : ${type}" th:text="${teacher.userName}" th:value="${teacher.userId}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label is-required">入学年份：</label>
                <div class="input-group date col-sm-8">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="comeYear" th:value="*{comeYear}" class="form-control" placeholder="请选择入学年份" type="text">
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "school/grade";
        $("#form-grade-edit").validate({
            focusCleanup: true
        });
        $("input[name='comeYear']").datetimepicker({
            format: "yyyy",
            autoclose: true,
            startView:4,
            minView:4,
            todayHighlight:true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-grade-edit').serialize());
            }
        }
    </script>
</body>
</html>